package nl.hanze.designpatterns.mvc.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import nl.hanze.designpatterns.mvc.model.Model;
/**
 * Main Controller class
 * A controller is always associated with 1 model.
 * Therefor the subclasses have to define which type of model they store.
 * @author Stephan E G Veenstra
 *
 */
public abstract class Controller<T> implements ActionListener{

	private T model;
	
	protected Controller(T model){
		this.setModel(model);
	}
	
	/**
	 * Set the model for this controller
	 * @param model
	 */
	public void setModel(T model){
		this.model = model;
	}
	
	/**
	 * Get the model from this controller
	 * @return
	 */
	public T getModel(){
		return this.model;
	}
	/**
	 * Should be overridden to perform actions
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		
	}
}
